#pragma once
#include "Helper.h"

namespace DXBase
{
	public ref class DXAdapter sealed
	{
	public:
		static Windows::Foundation::Collections::IIterable<DXAdapter^>^ GetAdapters();

		property Platform::String^ Description { Platform::String^ get() { return ref new Platform::String(description.Description); } }
		property uint64 DedicatedVideoMemory { uint64 get() { return description.DedicatedVideoMemory; } }
		property uint64 DedicatedSystemMemory { uint64 get() { return description.DedicatedVideoMemory; } }
		property uint64 SharedSystemMemory { uint64 get() { return description.DedicatedVideoMemory; } }
		property UINT VendorId { UINT get() { return description.VendorId; } }
		property UINT DeviceId { UINT get() { return description.DeviceId; } }
		property UINT SubSysId { UINT get() { return description.SubSysId; } }
		property UINT Revision { UINT get() { return description.Revision; } }

	internal:
		DXAdapter(Microsoft::WRL::ComPtr<IDXGIAdapter> ada);
		Microsoft::WRL::ComPtr<IDXGIAdapter> mAdapter;
		DXGI_ADAPTER_DESC description;
	private:
		DebugObject debug;
	};

	ref class EnumAdapter : Windows::Foundation::Collections::IIterator<DXAdapter^>, Windows::Foundation::Collections::IIterable<DXAdapter^>
	{
	public:
		virtual Windows::Foundation::Collections::IIterator<DXAdapter^>^ First();
		virtual bool MoveNext();
		virtual property DXAdapter^ Current { DXAdapter^ get(); }
		virtual property bool HasCurrent { bool get(); }
		virtual unsigned int GetMany(Platform::WriteOnlyArray<DXAdapter^>^ items);

	internal:
		DXAdapter^ current;
		UINT start;
		EnumAdapter();
		Microsoft::WRL::ComPtr<IDXGIFactory> mDxgiFactory;
	private:
		DebugObject debug;
	};
}